package com.example.xcpeekaboo;

import org.bukkit.plugin.java.JavaPlugin;
import com.example.xcpeekaboo.listeners.GameListener;
import com.example.xcpeekaboo.game.GameManager;
import com.example.xcpeekaboo.game.DisguiseManager;
import com.example.xcpeekaboo.commands.GameCommands;

public final class Xcpeekaboo extends JavaPlugin {

    @Override
    public void onEnable() {
        // 初始化游戏管理器
        GameManager.getInstance(this);
        DisguiseManager.getInstance();
        
        // 注册事件监听器
        getServer().getPluginManager().registerEvents(new GameListener(), this);
        
        // 注册命令
        GameCommands gameCommands = new GameCommands();
        getCommand("xcpkb").setExecutor(gameCommands);
        
        getLogger().info("躲猫猫插件已启动！");
    }

    @Override
    public void onDisable() {
        // 清理所有玩家的伪装
        DisguiseManager.getInstance().clearAllDisguises();
        // 重置游戏状态
        GameManager.getInstance().resetGame();
        
        getLogger().info("躲猫猫插件已关闭！");
    }
}
